package com.czmh.etc.interpreter.services.impl;

import com.czmh.etc.interpreter.Utils.CXFUtils;
import com.czmh.etc.interpreter.controller.InterpreterController;
import com.czmh.etc.interpreter.entity.InterpreterResponse;
import com.czmh.etc.interpreter.entity.base.EnMessagetype;
import com.czmh.etc.interpreter.entity.base.Header;
import com.czmh.etc.interpreter.entity.base.InterpreterContent;
import com.czmh.etc.interpreter.entity.base.ResponseBodyBase;
import com.czmh.etc.interpreter.entity.request.*;
import com.czmh.etc.interpreter.services.IReceiveService;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Huangyk on 2019/6/8.
 */
@Service(value = "receiveService")
@ConfigurationProperties(prefix = "cxf")
@PropertySource("classpath:application.yml")
public class ReceiveServiceImpl implements IReceiveService {
    public Logger logger = LoggerFactory.getLogger(InterpreterController.class);

    @Value("${url}")
    private String url;

    @Value("${methodName}")
    private String methodName;

    @Override
    public InterpreterResponse receiveMsgTypeContent(int msgType, String content) {
        EnMessagetype enMessagetype = EnMessagetype.loadEnMessageTypeEnum(msgType);
        InterpreterResponse response = new InterpreterResponse();
        ObjectMapper mapper = new ObjectMapper();
        Header requestBase = null;

        if(enMessagetype == null){
            response.setSuccess(false);
            response.setErrorMsg("\"" + msgType + "\"无法找到对应的报文类型！");
            return response;
        }else{
            switch (enMessagetype){
                case KeyRequest:
                    //region KeyRequest  9100
                    try {
                        requestBase = mapper.readValue(content, KeyRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【keyRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【keyRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【keyRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }

                    break;
                    //endregion
                case CardInfoChangeRequest:
                    //region CardInfoChangeRequest  9102
                    try {
                        requestBase = mapper.readValue(content, CardInfoChangeRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CardReissueRequest:
                    //region CardReissueRequest  9112
                    try {
                        requestBase = mapper.readValue(content, CardReissueRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardReissueRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardReissueRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardReissueRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CardDelayRequest:
                    //region CardDelayRequest  9140
                    try {
                        requestBase = mapper.readValue(content, CardDelayRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CustomBindingInfoRequest:
                    //region CustomBindingInfoRequest  9127
                    try {
                        requestBase = mapper.readValue(content, CustomBindingInfoRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomBindingInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomBindingInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomBindingInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CardUserInfoOperateRequest:
                    //region CardUserInfoOperateRequest  9133
                    try {
                        requestBase = mapper.readValue(content, CardUserInfoOperateRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardUserInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardUserInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardUserInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CardCarInfoOperateRequest:
                    //region CardCarInfoOperateRequest  9134
                    try {
                        requestBase = mapper.readValue(content, CardCarInfoOperateRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardCarInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardCarInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardCarInfoOperateRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CustomInfoRequest:
                    //region CustomInfoRequest  9128
                    try {
                        requestBase = mapper.readValue(content, CustomInfoRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CustomInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case FeeRuleRequest:
                    //region FeeRuleRequest  9132
                    try {
                        requestBase = mapper.readValue(content, FeeRuleRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【FeeRuleRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【FeeRuleRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【FeeRuleRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case OBUInfoRequest:
                    //region OBUInfoRequest  9131
                    try {
                        requestBase = mapper.readValue(content, OBUInfoRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case OBUDelayRequest:
                    //region OBUDelayRequest  9141
                    try {
                        requestBase = mapper.readValue(content, OBUDelayRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUDelayRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case PrechargeRequest:
                    //region PrechargeRequest  9106
                    try {
                        requestBase = mapper.readValue(content, PrechargeRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case PrechargeDetailRequest:
                    //region PrechargeDetailRequest  9130
                    try {
                        requestBase = mapper.readValue(content, PrechargeDetailRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【PrechargeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case CardInfoRequest:
                    //region CardInfoRequest  9107
                    try {
                        requestBase = mapper.readValue(content, CardInfoRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【CardInfoRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case LoadRequest:
                    //region LoadRequest  9108
                    try {
                        requestBase = mapper.readValue(content, LoadRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case LoadResultRequest:
                    //region LoadResultRequest  9109
                    try {
                        requestBase = mapper.readValue(content, LoadResultRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case LoadDetailRequest:
                    //region LoadDetailRequest  9129
                    try {
                        requestBase = mapper.readValue(content, LoadDetailRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【LoadDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case LossRequest:
                    //region LossRequest  9110
                    try {
                        requestBase = mapper.readValue(content, LossRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【LossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【LossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【LossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                //endregion
                case OBULossRequest:
                    //region OBULossRequest  9114
                    try {
                        requestBase = mapper.readValue(content, OBULossRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBULossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBULossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBULossRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case OBUChangeRequest:
                    //region OBUChangeRequest  9115
                    try {
                        requestBase = mapper.readValue(content, OBUChangeRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case DebitDeductRequest:
                    //region DebitDeductRequest  9118
                    try {
                        requestBase = mapper.readValue(content, DebitDeductRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【DebitDeductRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【DebitDeductRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【DebitDeductRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                //endregion
                case ConsumeDetailRequest:
                    //region ConsumeDetailRequest  9122
                    try {
                        requestBase = mapper.readValue(content, ConsumeDetailRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeDetailRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                //endregion
                case MonthSettleBillPrintRequest:
                    //region MonthSettleBillPrintRequest  9123
                    try {
                        requestBase = mapper.readValue(content, MonthSettleBillPrintRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                //endregion
                case MonthSettleBillPrintResultRequest:
                    //region MonthSettleBillPrintResultRequest  9125
                    try {
                        requestBase = mapper.readValue(content, MonthSettleBillPrintResultRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【MonthSettleBillPrintResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case ConsumeTransferAccountsRequest:
                    //region ConsumeTransferAccountsRequest  9124
                    try {
                        requestBase = mapper.readValue(content, ConsumeTransferAccountsRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeTransferAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeTransferAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【ConsumeTransferAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case OBUInfoChangeRequest:
                    //region OBUInfoChangeRequest  9104
                    try {
                        requestBase = mapper.readValue(content, OBUInfoChangeRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case OBUActivationRequest:
                    //region OBUActivationRequest 9139
                    try {
                        requestBase = mapper.readValue(content, OBUActivationRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUActivationRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUActivationRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【OBUActivationRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
                case VehicleCheckRequest:
                    //region VehicleCheckRequest 9138
                    try {
                        requestBase = mapper.readValue(content, VehicleCheckRequest.class);
                    } catch (JsonParseException e) {
                        logger.info("[receiveMsgTypeContent] 【VehicleCheckRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (JsonMappingException e) {
                        logger.info("[receiveMsgTypeContent] 【VehicleCheckRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    } catch (IOException e) {
                        logger.info("[receiveMsgTypeContent] 【VehicleCheckRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
                        e.printStackTrace();
                    }
                    break;
                    //endregion
    //            case OBUInfoChangeRequest:
    //                //region OBUInfoChangeRequest  9104
    //                try {
    //                    requestBase = mapper.readValue(content, OBUInfoChangeRequest.class);
    //                } catch (JsonParseException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (JsonMappingException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (IOException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUInfoChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                }
    //                break;
    //                //endregion
    //            case OBUIssuerResultRequest:
    //                //region OBUIssuerResultRequest  9131
    //                try {
    //                    requestBase = mapper.readValue(content, OBUIssuerResultRequest.class);
    //                } catch (JsonParseException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUIssuerResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (JsonMappingException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUIssuerResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (IOException e) {
    //                    logger.info("[receiveMsgTypeContent] 【OBUIssuerResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                }
    //                break;
    //                //endregion
    //            case DebitStatusChangeRequest:
    //                //region DebitStatusChangeRequest  9117
    //                try {
    //                    requestBase = mapper.readValue(content, DebitStatusChangeRequest.class);
    //                } catch (JsonParseException e) {
    //                    logger.info("[receiveMsgTypeContent] 【DebitStatusChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (JsonMappingException e) {
    //                    logger.info("[receiveMsgTypeContent] 【DebitStatusChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (IOException e) {
    //                    logger.info("[receiveMsgTypeContent] 【DebitStatusChangeRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                }
    //                break;
    //            //endregion
    //            case CancelResultRequest:
    //                //region CancelResultRequest  9111
    //                try {
    //                    requestBase = mapper.readValue(content, CancelResultRequest.class);
    //                } catch (JsonParseException e) {
    //                    logger.info("[receiveMsgTypeContent] 【CancelResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (JsonMappingException e) {
    //                    logger.info("[receiveMsgTypeContent] 【CancelResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (IOException e) {
    //                    logger.info("[receiveMsgTypeContent] 【CancelResultRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                }
    //                break;
    //            //endregion
    //            case LoadCheckAccountsRequest:
    //                //region LoadCheckAccountsRequest  9120
    //                try {
    //                    requestBase = mapper.readValue(content, LoadCheckAccountsRequest.class);
    //                } catch (JsonParseException e) {
    //                    logger.info("[receiveMsgTypeContent] 【LoadCheckAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (JsonMappingException e) {
    //                    logger.info("[receiveMsgTypeContent] 【LoadCheckAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                } catch (IOException e) {
    //                    logger.info("[receiveMsgTypeContent] 【LoadCheckAccountsRequest】JSON数据转换为Bean对象失败！原始字符串为\"" + content + "\"");
    //                    e.printStackTrace();
    //                }
    //                break;
    //            //endregion
                default:
                    response.setSuccess(false);
                    response.setErrorMsg("\"" + enMessagetype.getMessageType() + "\"无法找到对应的报文类型！");
                    return response;
            }
        }

        if(requestBase != null){
            List<Object> params = new ArrayList<Object>();
            params.add(msgType);
            params.add(content);

            try {
                Object[] cxfResult = CXFUtils.Call(url, methodName, params);

                String dataResult = StringUtils.join(cxfResult, "\n");

                logger.info("[receiveMsgTypeContent] 获取远程数据成功！获取原始响应数据为：\"" + dataResult + "\"");
                response.setSuccess(true);
                response.setData(dataResult);
            }catch (Exception exp){
                exp.printStackTrace();

                logger.info("[receiveMsgTypeContent] 获取远程数据出错！原始请求数据为：\"" + content + "\"");
                response.setSuccess(false);
                response.setErrorMsg("获取远程数据出错！");
            }

        }else{
            //转换KeyRequest对象失败！
            response.setSuccess(false);
            response.setErrorMsg("JSON数据转换请求对象失败！");
        }

        return response;
    }
}
